function getD2rUrl(){
    var d2r = localStorage.getItem('d2r');
    console.log(d2r);
    if(d2r>0||d2r==null){
        return "http://midownload.sinaapp.com/d2r/"
    }else{
        return "https://d.miwifi.com/d2r/"
    }
}
/*注释转字符串*/
function funString(f) {　
    return f.toString().replace(/^[^\/]+\/\*!?\s?/, '').replace(/\*\/[^\/]+$/, '');
}
/*插入css*/
function insertStyle(styles,styleId){
var style = document.createElement("style");
style.id = styleId?styleId:'';
(document.getElementsByTagName("head")[0] || document.body).appendChild(style);
style.appendChild(document.createTextNode(styles));
}
/*获取该页面的uri*/
function getURI(){
	return window.location.origin+window.location.pathname+window.location.search;
}
var mi = {
	/*通过连接下载*/
	download_url:function(_href,_name,_src) {
		var href = getD2rUrl()+"?url=" + Base64.encodeURI(_href) + "&src="+encodeURIComponent(_src)+'&name='+encodeURIComponent(_name)
    	window.open(href);
	},
	/*通过拦截事件下载*/
	/*推荐设置src 用于判断是否是来自该页面的连接 防止误下载*/
	download_event:function(_name,_src,_fun){
		chrome.extension.sendRequest({type:'fun',fun:'xmd',data:[_name,_src]}, _fun);
	}
}